import request from '@/utils/request'
import { praseStrEmpty } from '@/utils/ruoyi'

// 查询列表
export function listStat(query) {
  return request({
    url: '/system/useroperlog/list',
    method: 'get',
    params: query
  })
}

// 查询详细
export function getStat(userId) {
  return request({
    url: '/system/useroperlog/' + praseStrEmpty(userId),
    method: 'get'
  })
}

// 查询详细
export function listChart(query) {
  return request({
    url: '/system/useroperlog/brokenLineAccountProfile',
    method: 'get',
    params: query
  })
}

// 用户状态修改
export function changeAccountStatus(userId, status) {
  const data = {
    userId,
    status
  }
  return request({
    url: '/system/user/changeStatus',
    method: 'put',
    data: data
  })
}


// 新增
export function addAccount(data) {
  return request({
    url: '/system/user',
    method: 'post',
    data: data
  })
}

// 修改
export function updateAccount(data) {
  return request({
    url: '/system/user',
    method: 'put',
    data: data
  })
}

// 删除
export function delAccount(userId) {
  return request({
    url: '/system/user/' + userId,
    method: 'delete'
  })
}

// 用户密码重置
export function resetAccountPwd(userId, password) {
  const data = {
    userId,
    password
  }
  return request({
    url: '/system/user/resetPwd',
    method: 'put',
    data: data
  })
}

// 导出
export function exportAccount(query) {
  return request({
    url: '/system/user/export',
    method: 'get',
    params: query
  })
}

// 下载用户导入模板
export function importTemplate() {
  return request({
    url: '/system/user/importTemplate',
    method: 'get'
  })
}

